package com.ungao.tools.generator.create;

import com.ungao.tools.generator.Creator;
import com.ungao.tools.generator.engine.config.TemplateConfig;

import java.util.Objects;

public abstract class AbstractCreator<R, N> implements Creator {

    /**
     * 数据库表名称
     */
    protected N names;

    /**
     * 数据库表前缀
     */
    protected N alias;

    /**
     * 数据库表信息
     */
    protected R tables;

    /**
     * 模板配置信息
     */
    protected TemplateConfig configBuilder;

    public AbstractCreator(N names) {
        this.names = names;
    }

    public AbstractCreator(N names, N alias) {
        this.names = names;
        this.alias = alias;
    }

    @Override
    public AbstractCreator configuration(TemplateConfig configBuilder) throws Exception {
        Objects.requireNonNull(configBuilder, "the TemplateConfig is not to be null!");
        this.configBuilder = configBuilder;
        return this;
    }
}
